package com.happy_lab_management.demo.technician.lab.controller;


import com.happy_lab_management.demo.technician.lab.service.LabService;
import com.happy_lab_management.entity.Lab;
import com.happy_lab_management.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("technicianLabController")
@RequestMapping("/technician/lab")
public class LabController {
    @Autowired
    private LabService labService;
    @RequestMapping("add")
    public Result<String> add(@RequestBody Lab lab){
        labService.save(lab);
        return Result.success("添加实验室成功");
    }
    @RequestMapping("/list")
    public Result<List<Lab>> list() {
        List<Lab> labs = labService.list();

        return Result.success(labs);
    }

}
